<?php /* Smarty version 2.6.26, created on 2013-06-12 17:43:37
         compiled from minsshopshop_index.html */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', 'minsshopshop_index.html', 158, false),array('function', 'html_radios', 'minsshopshop_index.html', 187, false),array('function', 'cycle', 'minsshopshop_index.html', 242, false),array('modifier', 'date_format', 'minsshopshop_index.html', 259, false),)), $this); ?>
<?php echo '<?xml'; ?>
 version="1.0" encoding="utf-8"<?php echo '?>'; ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<link type="text/css" href="./assets/styles/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.fn.csv.value="download";
					document.fn.submit();
				}
			});
			$('#btn-reset').click(function(){	
				location.href = document.fn.action;
			});
			
			$('#btn_search').click(function(){
				if ( chkWeek() ) {
					document.fn.csv.value="";
					document.fn.submit();
				 }
			});
			
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			
			$('#year4').change(function(){
				var year4 = this.value;
				var myDate = new Date();
				var nowtime =  myDate.getTime();
				$.get("mmap_week_ajax.php",{ y: year4,t : nowtime }, function(data){
					$("#matrix_cd").children().remove();
					$("#matrix_cd").append( data ); 
				});
			});
			$('#year4c').change(function(){
				var year4c = this.value;
				var myDate = new Date();
				var nowtime =  myDate.getTime();
				$.get("mmap_week_ajax.php",{ y: year4c,t : nowtime }, function(data){
					$("#matrix_cdc").children().remove();
					$("#matrix_cdc").append( data ); 
				});
			});
			$('#btn-copy').click(function(){	
				var weekid = $("#matrix_cdc").val();
				if (weekid.length == 0){
					alert("コピー週を選択してください");
					return false;
				 }
				if( !confirm('コピーしてよろしいですか？') ){
					return false;
				}
				var weekfrom = document.fn.fweek.value;
				var year4c = $("#year4c").val();
				if (weekfrom==weekid) {
					alert("同じ週のデータはコピーできません");
					return false;
				}
				var myDate = new Date();
				var nowtime =  myDate.getTime();
				var tabCnt = 0;

				$.get("ajax_ins_shops_tab_exist.php",{ w: weekid,t : nowtime }, function(data){
					//alert(data);
					tabCnt = 1 * data;
					 if ( tabCnt ==1 ) {
						if( confirm('該当週のデータは既に存在します、コピーしてもよろしいですか？') ){
							document.fn.tweek.value = weekid;
							document.fn.csv.value = 'copy';
							document.fn.submit();
						}
					}
					if  ( tabCnt == 0 ) {
						alert("該当週のテーブルは存在しない。\r\nコピー前にテーブルを作成してください");
						return false;
					}
					
					if  ( tabCnt == 100 ) {
						document.fn.tweek.value = weekid;
						document.fn.csv.value="copy";
						document.fn.submit();
						return false;
					 }
				});
				 //document.fn.submit();
			});
			$('#btn-upd-ins').click(function(){
				//document.fn.tweek.value = weekid;
				document.fn.csv.value="updins";
				document.fn.submit();
				return false;
			});
			
			$('#btn-add').click(function(){	
				 if ( chkWeek() ) {
					 location.href = "minsshopshop_form.php?w=" + $("#matrix_cd").val();
				 }
			});
			
			$('.d_upd').click(function(){
				 if ( chkWeek() ) {
					 location.href = "minsshopshop_form.php?id=" +this.id + "&w=" + $("#matrix_cd").val();
				}
			});
		});
		
		function toPage(thepage) {
			document.fn.page.value =  thepage;
			document.fn.csv.value="";
			document.fn.submit();
		}
		
		function chkWeek() {
			var weekid = $("#matrix_cd").val() ;
			if (weekid.length == 0){
				alert("週を選択してください");
				return false;
			 }
			return true;
		}
		</script>
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />
		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
	</head>
	<body id="">
<?php echo $this->_tpl_vars['menu']; ?>

<?php echo $this->_tpl_vars['logout']; ?>

		<div id="container"><div class="wrapper">
			<h2>販売店紐付けマスター管理</h2>
			<ul class="submenu clearfix">
				<li>販売店紐付け情報一覧</li>
			</ul>
			<h3>販売店紐付け情報一覧</h3>
			<form name="fn" id="fn" method="get" action="minsshopshop_index.php" >
				<input type="hidden" name="page" />
				<table class="formTable">
					<tbody><tr>
						<th>※年度.週</th>
							<td>
<?php echo smarty_function_html_options(array('id' => 'year4','name' => 'year4','options' => $this->_tpl_vars['year4'],'selected' => $this->_tpl_vars['forms']['year4']), $this);?>
 年<?php echo $this->_tpl_vars['err']['year4']; ?>
&nbsp;&nbsp;&nbsp;
<?php echo smarty_function_html_options(array('id' => 'matrix_cd','name' => 'matrix_cd','options' => $this->_tpl_vars['week'],'selected' => $this->_tpl_vars['forms']['matrix_cd']), $this);?>
<?php echo $this->_tpl_vars['err']['matrix_cd']; ?>

							</td>
						</tr><tr>
							<th>店舗コード</th>
							<td>
								<input type="text" name="shop_cd" value="<?php echo $this->_tpl_vars['forms']['shop_cd']; ?>
" class="text" />
							</td>
						</tr><tr>
							<th>店舗名</th>
							<td>
								<input type="text" name="shop_name" value="<?php echo $this->_tpl_vars['forms']['shop_name']; ?>
" class="text" />
							</td>
						</tr>
						<!--  
						<tr>
							<th>販売店コード</th>
							<td>
								<input type="text" name="ins_shop_cd" value="<?php echo $this->_tpl_vars['forms']['ins_shop_cd']; ?>
" class="text" />
							</td>
						</tr>
						-->
						<tr><th>販売店名</th>
							<td>
								<input type="text" name="ins_shop_name" value="<?php echo $this->_tpl_vars['forms']['ins_shop_name']; ?>
" class="text" />
							</td>
						</tr><tr>
							<th>地域広告紐付</th>
							<td>
							<?php echo smarty_function_html_radios(array('name' => 'area_disp_ng','options' => $this->_tpl_vars['areaflags'],'selected' => $this->_tpl_vars['forms']['area_disp_ng'],'separator' => '&nbsp;'), $this);?>

							</td>
						</tr>
						<tr>
							<th>非表示設定</th>
							<td>
<?php echo smarty_function_html_radios(array('name' => 'disp_ng','options' => $this->_tpl_vars['flags'],'selected' => $this->_tpl_vars['forms']['disp_ng'],'separator' => '&nbsp;'), $this);?>

							</td>
						</tr><tr><th>重複チェック</th>
							<td>
								<label><input class="chkinput" type="checkbox" name="repeat_flg" value="1" <?php if ($this->_tpl_vars['forms']['repeat_flg']): ?>checked<?php endif; ?>  /> 有効なGEOコードの重複チェック</label>
							</td>
						</tr><tr>
							<th>更新日</th>
							<td>
								<input type="text" name="upd_f" class="text_date" value="<?php echo $this->_tpl_vars['forms']['upd_f']; ?>
" /> ～ 
								<input type="text" name="upd_t" class="text_date" value="<?php echo $this->_tpl_vars['forms']['upd_t']; ?>
" />
							</td></tr>
					</tbody>
				</table>
				<p class="button" style="text-align:right">
					<button type="button" id="btn-reset"><span>クリア</span></button>
					<button type="button" id="btn_search" class="submit"><span>絞込検索</span></button>
				</p>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
				<input type="hidden" name="tweek" />
				<input type="hidden" name="fweek"  value = "<?php echo $this->_tpl_vars['forms']['matrix_cd']; ?>
"/>
			</form>
			<?php if (( ! $this->_tpl_vars['isG5'] )): ?>
				<p class="button" style="text-align:left">
					<button type="button" id="btn-add"  ><span>新規追加</span></button>
				</p>
			<?php endif; ?>
<?php if (is_numeric ( $this->_tpl_vars['page']['cnt'] )): ?>
<?php if ($this->_tpl_vars['page']['cnt'] > 0): ?>
			<p class="message"><?php echo $this->_tpl_vars['page']['cnt']; ?>
件の情報が見つかりました。</p>
			<p align="left"><?php echo $this->_tpl_vars['pageing']; ?>
</p>
			<table id="search_result" class="sortable" >
				<thead>
					<tr>
						<th><h3>表示</h3></th>
						<th><h3>店舗コード</h3></th>
						<th><h3>店名</h3></th>
						<th><h3>地域広告<br>紐付</h3></th>
						<th><h3>販売店コード</h3></th>
						<th><h3>販売店名</h3></th>
						<th><h3>更新日時</h3></th>
						<th><h3>更新者</h3></th>
						<?php if (( ! $this->_tpl_vars['isG5'] )): ?><th><h3>操作</h3></th><?php endif; ?>
					</tr>
				</thead>
				<tbody>
<?php echo $this->_tpl_vars['nowindex']; ?>

<?php $_from = $this->_tpl_vars['data']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['member'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['member']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['v']):
        $this->_foreach['member']['iteration']++;
?>
				<tr class="<?php echo smarty_function_cycle(array('values' => "odd,mod",'name' => 'member'), $this);?>
">
	<?php if ($this->_tpl_vars['v']['rowspan'] == 1): ?>	
		<?php echo $this->_tpl_vars['nowindex']; ?>
	
						<td rowspan=<?php echo $this->_tpl_vars['v']['rowspannums']; ?>
 class="<?php echo $this->_tpl_vars['v']['rowspanclass']; ?>
 center" >
		<?php if ($this->_tpl_vars['v']['disp_ng'] == '1'): ?>
									<img src="assets/images/batu.png" > 
		<?php else: ?>
									&nbsp;
		<?php endif; ?>
						</td>
						<td rowspan=<?php echo $this->_tpl_vars['v']['rowspannums']; ?>
 class="<?php echo $this->_tpl_vars['v']['rowspanclass']; ?>
"><?php echo $this->_tpl_vars['v']['shop_cd']; ?>
</td>
						<td rowspan=<?php echo $this->_tpl_vars['v']['rowspannums']; ?>
 class="<?php echo $this->_tpl_vars['v']['rowspanclass']; ?>
"><?php echo $this->_tpl_vars['v']['shop_name']; ?>
</td>
	<?php endif; ?>
						<td><?php echo $this->_tpl_vars['v']['area_disp']; ?>
</td>
						<td><?php echo $this->_tpl_vars['v']['ins_shop_cd']; ?>
</td>
						<td><?php echo $this->_tpl_vars['v']['ins_shop_name']; ?>
</td>
	<?php if ($this->_tpl_vars['v']['rowspan'] == 1): ?>	
						<td  rowspan=<?php echo $this->_tpl_vars['v']['rowspannums']; ?>
  class="center <?php echo $this->_tpl_vars['v']['rowspanclass']; ?>
"><?php echo ((is_array($_tmp=$this->_tpl_vars['v']['u_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y/%m/%d %H:%M") : smarty_modifier_date_format($_tmp, "%Y/%m/%d %H:%M")); ?>
</td>
						<td  rowspan=<?php echo $this->_tpl_vars['v']['rowspannums']; ?>
  class="<?php echo $this->_tpl_vars['v']['rowspanclass']; ?>
"><?php echo $this->_tpl_vars['v']['m_user_name']; ?>
</td>
	
					<?php if (( ! $this->_tpl_vars['isG5'] )): ?><td  rowspan=<?php echo $this->_tpl_vars['v']['rowspannums']; ?>
  class="center <?php echo $this->_tpl_vars['v']['rowspanclass']; ?>
"> <a href='#' id='<?php echo $this->_tpl_vars['v']['shop_cd']; ?>
'  class='d_upd'> [更新]</a></td><?php endif; ?>
	<?php endif; ?>
					</tr>
<?php endforeach; endif; unset($_from); ?>
				</tbody>
			</table>
			<?php if (( ! $this->_tpl_vars['isG5'] )): ?>
				<p align="right"><?php echo $this->_tpl_vars['pageing']; ?>
</p>
				<p>結果を<?php echo smarty_function_html_options(array('id' => 'year4c','name' => 'year4c','options' => $this->_tpl_vars['year4'],'selected' => $this->_tpl_vars['forms']['year4c']), $this);?>
 年　<?php echo smarty_function_html_options(array('id' => 'matrix_cdc','name' => 'matrix_cdc','options' => $this->_tpl_vars['weekc'],'selected' => $this->_tpl_vars['forms']['matrix_cdc']), $this);?>
週へ<button type="button" id="btn-copy"  ><span>コピー</span></button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if ($this->_tpl_vars['copymsg']): ?> <?php echo $this->_tpl_vars['copymsg']; ?>
<?php endif; ?></p>
				<p>結果の販売店情報を更新する&nbsp;<button type="button" id="btn-upd-ins" ><span> 実行 </span></button> &nbsp;&nbsp;&nbsp;&nbsp;<?php if ($this->_tpl_vars['updinsmsg']): ?> <?php echo $this->_tpl_vars['updinsmsg']; ?>
<?php endif; ?></p>
			<?php endif; ?>
				<p class="button">
					<button type="button" id="btn-export"  ><span>CSVダウンロード</span></button>
				</p>

<?php else: ?>
<p class="message">条件にマッチする情報は見つかりませんでした。</p>
<?php endif; ?>
<?php else: ?>
	<p class="message">ここに検索結果が表示されます。</p>
<?php endif; ?>

		</div></div>
		<?php echo $this->_tpl_vars['footer']; ?>

	</body>
</html>